<?
 /*
 This file is part of TorrentParse 2.2.

    TorrentParse is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    TorrentParse is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with TorrentParse; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

   TorrentParse. TorrentParse parses bittorrent torrent files in PHP for use in web sites.
    Copyright (C) 2004 Kunkie
  Spaces in file names now work correctly
  The path to the torrents directory (HTML Problem)
  $fileend changed to lower case
  Fixed small bug with certain filenames and spaces

*/
           $dirpath = "./torrents";

    $dh = opendir($dirpath);
        while (false !== ($file = readdir($dh))) {
                       if (!is_dir("$dirpath/$file")) {
       $fileend = substr($file, -8);
             $fileend = strtolower($fileend);

if ( $fileend == ".torrent" ) {


                 // If you want you could merge this into one echo
                 // The info button takes you to parse.php, which is the important part
                                echo "<A HREF=\"parse.php?filename=$file\">";

                                echo "info:" ;
                                echo "</A>  " ;

                                echo "<A HREF=\"$dirpath/$file\">";

                                echo $file ;

                                echo "</A>";

                                echo "<BR>";
                                           }

}
    }
     closedir($dh);


?>